package com.bhprod.comatule.detail;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.util.Log;

import com.bhprod.comatule.R;
import com.bhprod.comatule.db.DBDataSource;

public class SpeciesDetailActivity extends FragmentActivity {

	private ViewPager pager;
	private SpeciesDetailAdapter pagerAdapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.detail_species);
		
		Bundle b = getIntent().getExtras();
		Integer speciesId = b.getInt("speciesId");
		Log.d(SpeciesDetailActivity.class.getName(), "SpeciesDetail species : " + speciesId.toString());
		
		pager = (ViewPager) findViewById(R.id.pagerDetailSpecies);
		pagerAdapter = new SpeciesDetailAdapter(getSupportFragmentManager(), this);
		pagerAdapter.setSpecies(DBDataSource.getInstance().getSpeciesById(speciesId));
		pager.setAdapter(pagerAdapter);
	}

//	@Override
//	public void onBackPressed() {
//		if (pager.getCurrentItem() == 0) {
//			// If the user is currently looking at the first step, allow the
//			// system to handle the
//			// Back button. This calls finish() on this activity and pops the
//			// back stack.
//			super.onBackPressed();
//		} else {
//			// Otherwise, select the previous step.
//			pager.setCurrentItem(pager.getCurrentItem() - 1);
//		}
//	}

}
